package com.lqd.mall.interaction.system;

import com.lqd.mall.interaction.basis.BasisEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.ArrayList;
import java.util.List;

/**
 * 部门表 sys_dept
 *
 * @author
 */
@Entity
@Setter
@Getter
@ToString
@Accessors(chain = true)
@Table(name = "sys_dept")
public class SysDeptEntity extends BasisEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 部门ID
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "dept_id")
    private Long deptId;

    /**
     * 父部门ID
     */
    @Column(name = "parent_id")
    private Long parentId;

    /**
     * 祖级列表
     */
    @Column(name = "ancestors")
    private String ancestors;

    /**
     * 部门名称
     */
    @Column(name = "dept_name")
    private String deptName;

    /**
     * 显示顺序
     */
    @Column(name = "order_num")
    private String orderNum;

    /**
     * 负责人
     */
    @Column(name = "leader")
    private String leader;

    /**
     * 联系电话
     */
    @Column(name = "phone")
    private String phone;

    /**
     * 邮箱
     */
    @Column(name = "email")
    private String email;

    /**
     * 部门状态:0正常,1停用
     */
    @Column(name = "status")
    private String status;

    /**
     * 父部门名称
     */
    @Transient
    private String parentName;

    /**
     * 子部门
     */
    @Transient
    private List<SysDeptEntity> children = new ArrayList<SysDeptEntity>();


}